package com.beerandjesus.sportofkings.handicapper.profile;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * Date: Jun 8, 2012
 * Time: 1:48:38 PM
 */
public class ProfileImpl implements Profile {
    private int score = -1;
    private final ProfileType type;

    public ProfileImpl(ProfileType type, int score) {
        this.type = type;
        this.score = score;
    }

    public int getScore() {
        return score;
    }

    public String getDescription() {
        return this.type.getDescription();
    }

    public String getName() {
        return type.getName();
    }

    public ProfileType getType() {
        return type;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProfileImpl that = (ProfileImpl) o;

        return score == that.score && type == that.type;

    }

    public int hashCode() {
        int result;
        result = score;
        result = 31 * result + (type != null ? type.hashCode() : 0);
        return result;
    }

    public String toString() {
        return new ToStringBuilder(this).append(type).append(score).toString();
    }
}
